function snap=gensnapshot(snap)
if isempty(snap),
    return;
end;
if mod(snap.number,snap.interval)==0,
    fn=sprintf(snap.filename,snap.number);
    h=snap.handle;
    if isempty(h)|h==0,
        h=gcf;
    end;
    print(h,['-d',snap.format],snap.options,[snap.dir,fn]);
end;
snap.number=snap.number+1;

